package other.third.service;


import other.third.entity.GetLocationByPhoneResponse;
import other.third.entity.GetTelephoneByIccIdResponse;
import other.third.entity.OrderLocationResponse;
import other.third.entity.base.ThirdRequest;
import other.third.entity.base.ThirdResponse;

/**
 * @author 王霄
 * @date 2021/4/20
 */
public class DefaultThirdClient extends AbstractThirdClient {

    @Override
    public ThirdResponse<GetTelephoneByIccIdResponse> getTelephoneByIccId(String iccId) {
        var request = ThirdRequest.build()
                .addUrl("www.baidu.com")
                .addMethod("getTelephonePlus")
                .addParam("iccid", iccId);
        var response = post(request, GetTelephoneByIccIdResponse.class);
        return ThirdResponse.build(response);
    }

    @Override
    public ThirdResponse<OrderLocationResponse> orderLocation(String cardId) {
        var request = ThirdRequest.build()
                .addUrl("www.baidu.com")
                .addMethod("orderLocation")
                .addParam("access_number", cardId);
        var response = post(request, OrderLocationResponse.class);
        return ThirdResponse.build(response);
    }

    @Override
    public ThirdResponse<GetLocationByPhoneResponse> getLocationByPhone(String cardId) {
        var request = ThirdRequest.build()
                .addUrl("www.baidu.com")
                .addMethod("getLocationByPhone")
                .addParam("access_number", cardId)
                .addParam("phone", "13899999999");
        var response = post(request, GetLocationByPhoneResponse.class);
        return ThirdResponse.build(response);
    }
}
